Day 1: Managing Users and Groups

Linux CLI

Linux is case-sensitive

3 main streams utilized in CLI:

Text Manipulation
grep
cut

sed
awk

Shells

Declaring Variables
NOW=$(date)

Double quotes expand special characters

\ = one literal character

history
!# reruns # command
!! rerun last command


.bashrc


Managing Users and Groups

su - Log in as specific user

sudo - run command with elevated privileges

UID - Account identifier that is unique to the system

3 Types of user accounts:

/etc/passwd contains account information

/etc/shadow requires root privileges to read

/etc/login.defs declares default configurations for new user accounts

/etc/skel "Default User" profile copied at account creation only.

chfn (change finger/change full name)

useradd -p WILL NOT encrypt the user password
passwd is used to set a users password
passwd -u = unlock
passwd -l = lock

usermod -U = unlock
usermod -L = lock

chage (change aging)

usermod (Add users to groups):

userdel -r user1 = remove profile and directories associated

/etc/group contains groups, ids, and members
group user1 = view user1 groups
groupadd
groupmod = can set password on groups for temporary membership
groupdel


User Profiles

Created from /etc/skel and read at login (can force rereade with . .bashrc):
~/.bash_logout
~/.bash_profile = Only read with the first login. Good for environmental variables.
~/.bashrc = Custom functions per profile

/etc/profile
/etc/bashrc = Custom functions globally defined


LAB

useradd -D user1 = View default settings for new users

useradd -c "Comment" user1 = Add comment to user account

useradd -e 2025/12/31 user1 = Add expiration date to user account

passwd user1 = Add password to user account

usermod -c "Comment" user1 = Add comment to user account

chage -l user1 = List password information for user account

chage -E 2026/12/31 user1 = Change password expiration for user account

passwd -l user1 = Lock user account

passwd -u user1 = Unlock user account

usermod -L user1 = Lock user account

usermod -U user1 = Unlock user account

userdel user1 = Delete user account

userdel -r user1 = Delete user account and associated directories

groupadd Group1 = Add group

groupmod -n NewName Group1 = Add new group name to exisiting group

usermod -aG Group1 user1 = Add user account to group

groupdel Group1 = Delete group but not users within group

who = Display logged in users

w = Display logged in users

last = Display recent logins